{% extends "basic.html" %}
{% block mainbody %}
{% load mytags %}
<form id="form1" class="form-horizontal" role="form" method="POST" action="/adminuser/editpost/" style="padding-bottom:100px;">
  {% csrf_token %}
  
  <input type="hidden" name="id" value="{{ info.id }}"/>
  
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">名称</label>
    <div class="col-sm-10">
      <h5>{{ info.factname }}</h5>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">帐号</label>
    <div class="col-sm-10">
      <h5>{{ info.username }}</h5>
    </div>
  </div>
  
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">是否启用</label>
    <div class="col-sm-10">
      {% for vo in whether_or_not %}
        <label class="checkbox-inline"><input type="radio" name="status" value="{{ vo.k }}" {% if vo.k == info.status|stringToInt %}checked{% endif %}>{{ vo.v }}</label>
      {% endfor %}
    </div>
  </div>
  
  
  <div id="btn_submit_fixed_bootom" class="form-group navbar-fixed-bottom" style="margin:5px;">
    <button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
  </div>
  <script type="text/javascript">document.write( '<style>div#btn_submit_fixed_bootom{visibility:hidden}@media(min-height:' + ($( window ).height() - 10) + 'px){div#btn_submit_fixed_bootom{visibility:visible}}</style>' );</script>
</form>
<script type="text/javascript">
$(document).ready(function(){
  //return true;
  $("#form1").submit(function(){
    var data=$(this).serialize();
    var url=$(this).attr("action");
    var tips=art.dialog.tips("正在提交……");
    
    $.ajax({
      async:false,
      type:'POST',
      url:url,
      data:data,
      success:function(rsObj){
        if(rsObj.response_code=="1"){
          art.dialog({
            content:rsObj.response_message,
            cancelVal:'继续修改',
            cancel:function(){
              tips.close();
            },
            okVal:'返回列表',
            ok:function(){
              javascript:window.history.go(-1);
            }
          });
        }else{
          art.dialog.alert(rsObj.response_message);
        }
      },
      cache:false
    });
    return false;
  });
});
</script>
{% endblock %}